package com.zbl.zblproject.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.core.entity.SmallUnit;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/16
 */
@Repository
public interface SmallUnitMapper extends BaseMapper<SmallUnit> {

    @Select("SELECT b.name FROM zbl_goods AS a LEFT JOIN  zbl_small_unit AS b ON a.smallunit_id = b.id WHERE a.goods_id = #{goodsId} ")
    String selectUnitNameByGoodsId(@Param("goodsId") int goodsId);

    @Select("SELECT name FROM zbl_small_unit where id=#{unitId}" )
    String selectUnitNameById(@Param("unitId") int unitId);
}
